/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ats.ereg.model.entities;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Ali
 */
@Entity
@Table(name = "tst_std_courses")
@NamedQueries({
    @NamedQuery(name = "TstStdCourses.findAll", query = "SELECT t FROM TstStdCourses t")})
public class TstStdCourses implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TstStdCoursesPK tstStdCoursesPK;
    @JoinColumn(name = "std_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private TstStudents tstStudents;
    @JoinColumn(name = "crs_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private TstCourses tstCourses;
    @JoinColumn(name = "semester_id", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private TstSemesters tstSemesters;

    public TstStdCourses() {
    }

    public TstStdCourses(TstStdCoursesPK tstStdCoursesPK) {
        this.tstStdCoursesPK = tstStdCoursesPK;
    }

    public TstStdCourses(int stdId, int crsId, int semesterId) {
        this.tstStdCoursesPK = new TstStdCoursesPK(stdId, crsId, semesterId);
    }

    public TstStdCoursesPK getTstStdCoursesPK() {
        return tstStdCoursesPK;
    }

    public void setTstStdCoursesPK(TstStdCoursesPK tstStdCoursesPK) {
        this.tstStdCoursesPK = tstStdCoursesPK;
    }

    public TstStudents getTstStudents() {
        return tstStudents;
    }

    public void setTstStudents(TstStudents tstStudents) {
        this.tstStudents = tstStudents;
    }

    public TstCourses getTstCourses() {
        return tstCourses;
    }

    public void setTstCourses(TstCourses tstCourses) {
        this.tstCourses = tstCourses;
    }

    public TstSemesters getTstSemesters() {
        return tstSemesters;
    }

    public void setTstSemesters(TstSemesters tstSemesters) {
        this.tstSemesters = tstSemesters;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tstStdCoursesPK != null ? tstStdCoursesPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TstStdCourses)) {
            return false;
        }
        TstStdCourses other = (TstStdCourses) object;
        if ((this.tstStdCoursesPK == null && other.tstStdCoursesPK != null) || (this.tstStdCoursesPK != null && !this.tstStdCoursesPK.equals(other.tstStdCoursesPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ats.ereg.model.entities.TstStdCourses[ tstStdCoursesPK=" + tstStdCoursesPK + " ]";
    }
    
}
